package com.gimi.cloud.jimi.common.exception;

import com.gimi.cloud.jimi.common.enums.ResponseCodeEnum;

/**
 * 自定义消息异常类
 * @author zhoufuhang
 * @time 2017年10月13日
 */
public class MsgException extends RuntimeException{

	private static final long serialVersionUID = 1L;

	private String msgCode;

	/**
	 * 抛出异常后，返回给用户的head提示
	 */
	private ResponseCodeEnum msgEnum;
	
	/**
	 * 抛出异常后，返回给用户的数据
	 */
	private String exceptionMsg;

	public MsgException(ResponseCodeEnum msgEnum, String exceptionMsg) {
		super(msgEnum.getDesc());
		this.exceptionMsg = exceptionMsg;
		this.msgEnum = msgEnum;
	}
	
	public MsgException(ResponseCodeEnum msgEnum) {
		super(msgEnum.getDesc());
		this.msgEnum = msgEnum;
	}

	public MsgException(String msgCode, String exceptionMsg ) {
		super(exceptionMsg);
		this.exceptionMsg = exceptionMsg;
		this.msgCode = msgCode;
	}

	public ResponseCodeEnum getMsgEnum() {
		return msgEnum;
	}

	public String getExceptionMsg() {
		return exceptionMsg;
	}

	public String getMsgCode() {
		return msgCode;
	}
}
